package main

import(
	"fmt"
	// "time"
	"sync"
)

func hello1() {
    fmt.Println("Hello Goroutine!")
}

var wg sync.WaitGroup
func hello2(i int) {
	defer wg.Done()
	fmt.Println("Hello Goroutine", i)
}



func main() {
	// 1. 启动单个goroutine
	// go hello()
	// fmt.Println("Main Goroutine!")
	// time.Sleep(time.Second)

	// 2. 启动多个goroutine
	for i := 0; i < 10; i++ {
		wg.Add(1)
		go hello2(i)
	}
	wg.Wait()
}
